import java.util.LinkedList;
import java.util.List;
import java.util.Scanner;

/**
 * 输入n，代表1-n的n个数，输入k，返回这n个数所有可能的k个数的组合
 */

public class CombineTwoNums {
    public static LinkedList<Integer> path = new LinkedList<>();
    public static LinkedList<LinkedList<Integer>> result = new LinkedList<LinkedList<Integer>>();
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int k = scanner.nextInt();
        backtrack(n, k, 1);
        for(LinkedList<Integer> list : result) {
            System.out.println(list);
        }

    }

    private static void backtrack(int n, int k, int startIndex) {
        if (path.size() == k) {
            result.add(new LinkedList<>(path));
        }
        for (int i=startIndex;i<=n;i++) {
            path.add(i);
            backtrack(n, k, i+1);
            path.removeLast();
        }
    }


}
